<template>
	<!-- 	<view>
		<WtmPop  
			ref="pop" 
			direction="center" 
			:is_close="true" 
			:is_mask="true" 
			:width="100"  
			height="80vh" 
			:maskFun="true" 
			@watchOpen="watchOpen" 
			@watchClose="watchClose"
		>
			<view class="" v-for="t in 100">我是弹窗</view>
		</WtmPop> 
		<button type="default" @click="$refs.pop.show();">打开弹窗</button>
	</view> -->
	<view>
		<WtmDetail :Entity="Entity" :ID="ID" :readonly="readonly" :isBatchUpdate="isBatchUpdate"></WtmDetail>
		<!-- <WtmImage ref="image" :count="1" :sizeTypeIndex="2" :sourceTypeIndex="2" :images="images"></WtmImage> -->
<!-- 		<button type="default" @click="uploadimage">上传图片</button>
		<WtmFile ref="file" :count="12"></WtmFile>
		<button type="default" @click="uploadfile">上传文件</button> -->
<!-- 		<view>{{images.value}}

		</view> -->
	</view>
</template>

<script>
	import {
		Entity,
		NewEntity,
		Pagination
		//Pagination
	} from '../controller/entity.js'
	import fileservice from '../../../myservice/fileservice.js'

	export default {
		data() {
			return {
				Entity: [
					Entity.SchoolCode,
					Entity.SchoolName,
					Entity.SchoolType,
					// Entity.SchoolImage,
					Entity.Remark
				],
				ID: 0,
				readonly: 0,
				isBatchUpdate: 0, //1：批量修改
				imageList: null,
				//phoneIds: [], //
				fileList: [],
				//fileIds:[]
				//Pagination: Pagination
				//images:Entity.SchoolImage
			}
		},
		methods: {
			// watchOpen(){},
			// watchClose(){}
			uploadimage() {
				var that = this;
				//that.phoneIds = [];
				this.imageList = this.$refs.image.getImageList();
				console.log(JSON.stringify(this.imageList))
				// var i = 0;
				// that.imageList.map((value, index) => {
				// 	fileservice.uploadImage(value).then(res => {
				// 		console.log(JSON.stringify(res))
				// 		if (res.statusCode == 200) {
				// 			var data = JSON.parse(res.data);
				// 			that.phoneIds.push(data.Id)
				// 			//console.log((that.imageList.length-1)+"__"+index)
				// 			i++;
				// 			if (i == that.imageList.length) {
				// 				//console.log(JSON.stringify(phoneIds))
				// 				//this.$parent.getimage2(phoneIds);
				// 				that.getImageList();
				// 			}
				// 		} else {
				// 			uni.showToast({
				// 				title: res.errMsg,
				// 				icon: 'none'
				// 			});
				// 		}
				// 	})
				// })
			},
			uploadfile() {
				var that = this;
				this.fileList = this.$refs.file.getFileList();
				console.log(JSON.stringify(this.fileList))
			}
		},
		onLoad(options) {
			NewEntity(); //初始化Entity数据
			this.ID = Number.isNaN(parseInt(options.detail)) ? 0 : parseInt(options.detail);
			this.readonly = Number.isNaN(parseInt(options.readonly)) ? 0 : parseInt(options.readonly);
			this.isBatchUpdate = Number.isNaN(parseInt(options.isBatchUpdate)) ? 0 : parseInt(options.isBatchUpdate);
			if (this.isBatchUpdate == 1) { //如果是批量修改，则只可以修改，类型和备注
				this.Entity = [
					Entity.SchoolType,
					Entity.Remark
				];
			}
			console.log(this.ID + '__' + this.readonly)
		},
		provide: {
			Pagination: Pagination
		},
		onUnload() {
			NewEntity(); //初始化Entity数据
		}
	}
</script>

<style scoped>
	/* 	.box view {
		text-align: center;
		margin: 20px;
		background-color: #007AFF;
		color: #FFFFFF;
		border-radius: 3px;
		padding: 10px 0;
	} */
</style>
